﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using com.ClickCricket.dal;

/// <summary>
/// Summary description for PlayerService
/// </summary>
/// 
namespace com.ClickCricket.bll
{
    public class PlayerService
    {
        private static PlayerService instance;

        public static PlayerService Instance 
        {
            get
            {
                if (instance == null)
                {
                    instance = new PlayerService();
                }
                return instance;
            }
        }

        private readonly IPlayerProvider playerProvider;

        public PlayerService(IPlayerProvider playerProvider)
        {
            this.playerProvider = playerProvider;
        }

        public PlayerService()
            : this(new PlayerLinqProvider())
        {
         
        }



        public Player getRandomPlayer()
        {
            return playerProvider.getRandomPlayer();
        }

        public Player getPlayer(int playerId)
        {
            return playerProvider.getPlayer(playerId);
        }

        public List<Player> getPlayers(string letter)
        {
            return playerProvider.getPlayers(letter);
        }
             
    }
}
